package com.zhentao.controller;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.pojo.station.StationInformation;
import com.zhentao.model.common.pojo.users.MassageParam;
import com.zhentao.service.StationInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/station")
public class StationInfoController {
    @Autowired
    private StationInformationService stationInformationService;
    @GetMapping("/list")
    public ResponseResult list(@RequestParam("userId") Long userId,
                               @RequestParam(value = "stationName", required = false) String stationName,
                               @RequestParam(value = "washFee", required = false) Boolean washFee,
                               @RequestParam(value = "shoppingMall", required = false) Boolean shoppingMall,
                               @RequestParam(value = "lounge", required = false) Boolean lounge,
                               @RequestParam(value = "restroom", required = false) Boolean restroom,
                               @RequestParam(value = "carWash", required = false) Boolean carWash) {

        // 打印接收到的参数进行调试
        System.out.println("Received userId: " + userId);
        System.out.println("Received stationName: " + stationName);
        System.out.println("Received washFee: " + washFee);
        System.out.println("Received shoppingMall: " + shoppingMall);
        System.out.println("Received lounge: " + lounge);
        System.out.println("Received restroom: " + restroom);
        System.out.println("Received carWash: " + carWash);

        // 调用 service 层获取数据
        return stationInformationService.listStation(userId, stationName, washFee, shoppingMall, lounge, restroom, carWash);
    }
//      车站详情
    @GetMapping("/listxq")
    public ResponseResult detail( ) {
        return stationInformationService.detail();
    }

//    收藏的内容
    @GetMapping("/collect")
    public ResponseResult collect(@RequestParam("userId") Long userId){
        System.out.println("Received userId: " + userId);  // 调试用
        return stationInformationService.collect(userId);
    }



//    修改收藏的状态（收藏）
    @PostMapping("/ShouId")
    public ResponseResult ShouId(@RequestParam Integer id) {
         return stationInformationService.ShouId(id);
    }

//  修改收藏的状态（取消收藏）
    @PostMapping("/QuXiaoShou")
    public ResponseResult QuXiaoShou(@RequestParam Integer id) {
         return stationInformationService.QuXiaoShou(id);
    }


//    --------------------------------------------------------------------
//    我的优惠卷
    @GetMapping("/listwd")
    public ResponseResult listwd(@RequestParam("userId") Long userId) {
        System.out.println("Received userId: " + userId);  // 调试用
        return stationInformationService.listwd(userId);
    }
}
